   var linkurl = "http://"+window.location.host+"/";//获取当前域名
    var t = n = 0, count;
    var index = 0;
    var auto_timer;
    var countpage=1;
    var search = GetQueryString("search");
    var page = 1;
    var indexs = ["①","②","③","④","⑤","⑥","⑦","⑧","⑨","⑩"];
    $(document).ready(function () {
     // 分页按钮加载结束
        $.ajax({
            type: 'get',
            url : linkurl + "getAdList",
            data: {pid:1},
            dataType: 'json',
            success:function (Result) {
                var html="";
                var data = Result.data;
                $("#banner_list").html("");
                $.each(data,function (index,item) {
                    html =html+"<a class='item2 rel' target='_blank' href='//"+item.linkUrl+"'>" +
                        "<img class='banner-img' src='"+linkurl+"images/ad/"+item.img+"'>" +
                        "<div class='title-mask abs'></div>" +
                        "<div class='title abs fff' style='font-size:26px;'>"+item.adTitle+"</div>" +
                        "</a>";
                })
                $("#banner_list").html(html);
            }
        });
        count = 3;
        for(var i = 1;i<count;i++){$("#banner").append("<li></li>");}
        $("#banner_list a:not(:first-child)").hide();
        $("#banner_info").html($("#banner_list a:first-child").find("img").attr('alt'));
        $("#banner_info").click(function () {
            window.open($("#banner_list a:first-child").attr('href'), "_blank")
        });
        $("#banner li").on('click', function () {
            var i = $(this).index();//获取Li元素内的值，即1，2，3，4
            n = i;
            if (i >= count) return;
            $("#banner_info").html($("#banner_list a").eq(i).find("img").attr('alt'));
            $("#banner_info").unbind().click(function () {
                window.open($("#banner_list a").eq(i).attr('href'), "_blank")
            });
            $("#banner_list a").filter(":visible").hide().parent().children().eq(i).show();
            document.getElementById("banner").style.background = "";
            $(this).toggleClass("on");
            $(this).siblings().removeAttr("class");
        });
        t = setInterval("showAuto()", 3000);
        $("#banner").hover(function () {
            clearInterval(t)
        }, function () {
            t = setInterval("showAuto()", 3000);
        });
    });
    function showAuto() {
        n = n >= (count - 1) ? 0 : ++n;
        //console.log("n="+n)
        $("#banner li").eq(n).trigger('click');
    }
    function autoChangeItem() {
        index++;
        var length = $("#live_radio_list").find('.broadcast').length;
        var i = index % length;
        $("#live_radio_list").find('.broadcast').removeClass('hide').addClass('hide');
        $("#live_radio_list").find('.broadcast').eq(i).removeClass('hide');
    }
    function GetQueryString(name)
    {
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if(r!=null)return  unescape(decodeURI(r[2])); return null;
    }
    $(function () {
        $.ajax({
            type: 'get',
            url : linkurl + "getXunrenClassifyList",
            data: {},
            dataType: 'json',
            success: function (Result) {
                var  data = Result.data;
                $("#pcc-classify").html("");
                $.each(data, function (index,item) {
                    $("#pcc-classify").append("<a href='d-"+item.id+"/'>"+item.className+"</a>")
                })
            }
        });
        $.ajax({
            type: 'get',
            url : linkurl + "getCommendList",
            data: {},
            dataType: 'json',
            success: function (Result) {
                var  data = Result.data;
                $(".pcc-item-in").html("");
                $.each(data, function (index,item) {
                    $(".pcc-item-in").append("<li>" +
                        "<a href='"+item.linkUrl+"'>" +
                        "<span class='text'>"+item.title+"</span>" +
                        "<span class='muted'>" +
                        "<time><i class='fa fa-clock-o'></i>"+dateFormatUtil(item.createTime*1000)+"</time>" +
                        "</span>" +
                        "<span class='muted'>阅读("+item.hits+")" +
                        "</span>" +
                        "</a>" +
                        "</li>")
                })
            }
        });
        getXunrenList(page,search);
           // 分页按钮加载
	   $("#demo1").paginate({
		                count       : countpage,
		                start       : 1,
		                display     : 10,
		                border                  : true,
		                border_color            : '#cecece',
		                text_color              : '#666666',
		                background_color        : '#ffffff',    
		                border_hover_color      : '#ff8420',
		                text_hover_color        : 'ff8420',
		                background_hover_color  : '#ffffff', 
		                rotate      : false,
		                images      : false,
		                mouse       : 'press'
		     });
        $.ajax({
            type : "get",
            url : linkurl + "getXunrenList",
            data: {pagesize:10},
            dataType: 'json',
            success:function (Result) {
                var data = Result.data;
                $("#live_radio_list").html("<div class='live_radio_listtitle'><h3>本站最新发布</h3></div>");
                $.each(data, function (index,item) {
                    if(index<=2){
                        $("#live_radio_list").append("<a href='"+item.url+"/"+item.linkUrl+"' class='live_xunren_list'><span class='pcc-colorff8420 pcc_padding10'>"+indexs[index]+"</span>["+item.provinceName+"] "+item.title+" </a>");
                       }else{
                        $("#live_radio_list").append("<a href='"+item.url+"/"+item.linkUrl+"' class='live_xunren_list'><span class='pcc-colore0dbdb pcc_padding10'>"+indexs[index]+"</span>["+item.provinceName+"] "+item.title+" </a>");
                       }
                })
            }
        });
        $.ajax({
            type : "get",
            url : linkurl + "isLoged",
            data: {},
            dataType: 'json',
            success:function (Result) {
                var result = Result.result;
                if(result==1){
                    $(".pcc_gerenbnt").removeClass("hide");
                    $("#to-login").addClass("hide");
                    $("#to-reg").addClass("hide");
                }
            }
        });
        $.ajax({
        type : "get",
        url : linkurl + "getXunrenList",
        data: {pagesize:3},
        dataType: 'json',
        success:function (Result) {
            var data = Result.data;
            $("#pcc-foot-x").html("");
            $.each(data, function (index,item) {
                $("#pcc-foot-x").append("<div class='pcc-articlefool' ><a class='live_xunren_list' href='"+item.url+"/"+item.linkUrl+"'>["+item.provinceName+"]"+item.title+"</a>" +
                    "<p>"+item.content+"</p></div>");
            });
        }
    });
        $.ajax({
        type : "get",
        url : linkurl + "getTopDiqu",
        data: {},
        dataType: 'json',
        success:function (Result) {
            var data = Result.data;
            $("#pcc-foot-c").html("");
            $.each(data,function (index,item) {
                $("#pcc-foot-c").append("<a class='pcc_fooldiquxunren' href='a-"+item.url+"/'>"+item.diquName+"寻人</a>")
            })
        }
    });
    $(".search_button3").click(function () {
	    var search = $("#search_key").val();
	    if(search!=""){
	        window.location.href = "sousuojieguo.html?search=" + search;
	    }
	});
	//右侧导航点击回到头部
    $("#sidebar-c").click(function(){
                   $('body,html').animate({scrollTop:0},1000);
                   return false;
               });
    $("#pcc-logout").click(function () {
            $.ajax({
                type : "post",
                url : linkurl + "logout",
                data: {},
                dataType: 'json',
                success:function () {
                    $(".pcc_gerenbnt").addClass("hide");
                    $("#to-login").removeClass("hide");
                    $("#to-reg").removeClass("hide");
                }
            })
        });
        $.ajax({
            type : "get",
            url : linkurl + "getDiquListByType",
            data: {types : 1,pid : 0},
            dataType: 'json',
            success : function (Result) {
                var data = Result.data;
                $("#pcc-area").html("");
                $.each(data, function (index,item) {
                    $("#pcc-area").append("<a href='"+item.url+"'>"+item.diquName+"寻人</a>")
                })
            }
        });
       
    $(".search_button3").click(function () {
	    var search = $("#search_key").val();
	    if(search!=""){
	        location.href = "sousuojieguo.html?search=" + search;
	    }
	});
	  $(".jPag-pages li").click(function(){
	          var page = $(this).text();
	          getXunrenList(page);
	    })
    })
    function getXunrenList(page){
       $.ajax({
            type : "get",
            url : linkurl + "getXunrenList",
            data: {page : page,search:search,pagesize : 3},
            dataType: 'json',
            success:function (Result) {
                if(page == 1){$("#pcc-list").html("");}
                var data = Result.data;
                var html="";
                countpage= data[0].total;
                $.each(data,function (index,item) {
                    html=html+("<a class='article-list cursor' target='_blank' href='"+item.url+"/"+item.linkUrl+"'>" +
                        "<div class='article1 rel bb'>" +
                        "<div class='title1 hover c3333'>["+item.provinceName+"]"+item.title+"</div>" +
                        "<div class='author1 c333'>寻找人："+item.contact+" <em class='bbb'>"+dateFormatUtil(item.createTime*1000)+"</em></div>" +
                        "<div class='summary1'>"+item.content+"</div>" +
                        "</div>" +
                        "</a>")
                })
                    $("#pcc-list").html(html); 
                 
                }
        })
    }
    function dateFormatUtil(longTypeDate){
        var dateTypeDate = "";
        var date = new Date();
        date.setTime(longTypeDate);
        dateTypeDate += date.getFullYear();   //年
        dateTypeDate += "-" + getMonth(date); //月
        dateTypeDate += "-" + getDay(date);   //日
        return dateTypeDate;
    }


    //返回 01-12 的月份值
    function getMonth(date){
        var month = "";
        month = date.getMonth() + 1; //getMonth()得到的月份是0-11
        if(month<10){
            month = "0" + month;
        }
        return month;
    }

    //返回01-30的日期
    function getDay(date){
        var day = "";
        day = date.getDate();
        if(day<10){
            day = "0" + day;
        }
        return day;
    }